﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TeamFoundation.EventBus.Client
{
    /// <summary>
    /// Represents a client subscription to a TFS event.
    /// </summary>
    public partial class Subscription
    {
        /// <summary>
        /// Gets the name of the subscription.
        /// </summary>
        public string Name
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets or sets the filter.
        /// </summary>
        public string Filter
        {
            get;
            set;
        }

        private string _originalQueue;
        /// <summary>
        /// Gets or sets the queue to use.
        /// </summary>
        public string Queue
        {
            get;
            set;
        }

        internal Subscription(Service.EventSubscription sub)
        {
            Name = sub.name;
            Filter = sub.filter;
            Queue = sub.pipe;
            _originalQueue = sub.pipe;
        }

        /// <summary>
        /// Subscribes to this subscription.
        /// </summary>
        /// <returns>The subscription.</returns>
        public TfsQueueSubscription Subscribe()
        {
            return new TfsQueueSubscription(this._originalQueue);
        }
    }
}
